import request from '@/utils/request'
import BaseUrl from '@/utils/BaseUrl'
import { getRealname } from '@/utils/auth'

/**
 * 列表
 * @param query
 * @returns {AxiosPromise}
 */
export function listGenConfig(query) {
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/config/list',
    data: query
  })
}

/**
 * 删除
 * @param data
 * @returns {AxiosPromise}
 */
export function deleteGenConfig(data) {
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/config/delete',
    data: data
  })
}

/**
 * 增加
 * @param data
 * @returns {AxiosPromise}
 */
export function addGenConfig(data) {
  data.createdBy = getRealname()
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/config/add',
    data: data
  })
}

/**
 * 修改
 * @param data
 * @returns {AxiosPromise}
 */
export function updateGenConfig(data) {
  data.modifiedBy = getRealname()
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/config/update',
    data: data
  })
}

/**
 * 获取单个
 * @param query
 * @returns {AxiosPromise}
 */
export function getGenConfig(query) {
  return request({
    url: BaseUrl.API_CODE_GENERATE + '/gen/config/get',
    data: query
  })
}
